<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
   <!-- jQuery -->
    <script src="${pageContext.request.contextPath }/statics/js/jquery.min.js"></script>
    <!-- Bootstrap -->
    <script src="${pageContext.request.contextPath }/statics/js/bootstrap.min.js"></script>
    <!-- FastClick -->
    <script src="${pageContext.request.contextPath }/statics/js/fastclick.js"></script>
    <!-- NProgress -->
    <script src="${pageContext.request.contextPath }/statics/js/nprogress.js"></script>
    <!-- jQuery custom content scroller -->
    <script src="${pageContext.request.contextPath }/statics/js/jquery.mCustomScrollbar.concat.min.js"></script>
    <!-- Custom Theme Scripts -->
    <script src="${pageContext.request.contextPath }/statics/js/custom.min.js"></script>
    <!-- validator -->
<%--     <script src="${pageContext.request.contextPath }/statics/js/validator.js"></script> --%>
    <!-- dropzone -->
    <script src="${pageContext.request.contextPath }/statics/js/dropzone.js"></script>
<script>
    function download(appId,url){
        $.ajax({
            type:"GET",//请求类型
            url:"${pageContext.request.contextPath }/dev/download",//请求的url
            data:{id:appId},//请求参数
            dataType:"json",//ajax接口（请求url）返回的数据类型
            success:function(result){//data：返回数据（json对象）
                window.open(url,'target','');
            },
            error:function(data){//当访问时候，404，500 等非200的错误状态码
                alert("下载失败!")
            }
        });
    }


    function delfile() {
     $("#uploadfile").show();
     $("#apkFile").html('');
    }

    //上传APK文件---------------------
    var downloadLink = $("#downloadLink").val();
    var id = $("#id").val();
    var appId = $("#appId").val();
    var urlDress = $("#urlDress").val();
    var apkFileName = $("#apkFileName").val();
    if (downloadLink == null || downloadLink == "") {
     $("#uploadfile").show();
    } else {
     $("#apkFile").append("<p>" + apkFileName +
             "&nbsp;&nbsp;<a id='download' href=javascript:download("+appId+",'http://localhost/" + downloadLink +"')>下载</a> &nbsp;&nbsp;" +
             "<a href=\"javascript:;\" onclick=\"delfile();\">删除</a></p>");
    }

</script>